import time
import unittest

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys


class ChromeTestCase(unittest.TestCase):
    """
    这是一个 Chrome 的 测试集
    """
    driver = None

    @classmethod
    def setUp(cls):
        cls.driver = webdriver.Firefox()

    def test_firefox(self):
        self.driver.get("https://www.baidu.com/")

        self.driver.find_element(By.ID, 'kw').send_keys("selenium", Keys.RETURN)

        # 让 脚本 强制 停止  5s
        time.sleep(5)

        # 在浏览器中 使用 导航栏 对象
        self.driver.back()  # 后退
        time.sleep(3)

        self.driver.forward()  # 前进
        time.sleep(3)

        self.driver.refresh()  # 刷新
        time.sleep(3)

    @classmethod
    def tearDown(cls):
        # cls.driver.close()
        pass


if __name__ == '__main__':
    unittest.main()
